/*
 * This application is used for debug purpose only
 */

import java.net.*;

public class send {
	public static th t;

	public static void main(String args[]) {
		System.out.println("Strating test app...");
		t = new th();

		try {
			t.start();
			t.join();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
}

class th extends Thread {
	public static DatagramSocket socket;
	public static DatagramPacket packet;

	byte[] data = new byte[4];

	public void run() {
		try {
			socket = new DatagramSocket(1115);
		} catch (Exception ex) {
			ex.printStackTrace();
		}
		int count = 0;
		while (true) {
			try 
			{
				sleep(1000);
			} catch (Exception ex) {
				ex.printStackTrace();
			}
/*
			byte s1 = 0;
			int math2 = 0;
			if (count < 10) {
				math2 = 1;
				data[3] = (byte) count;
			} else {
				math2 = 2;
				data[3] = (byte) (count - 10);
			}
			byte s2 = (byte) math2;

			data[0] = s1;
			data[1] = s2;
			data[2] = 0;
			
			data[0] = 0;
			data[1] = 2;
			data[2] = (byte) 0x6b;
			data[3] = (byte) 0x87;
*/
			data[0] = 0;
			data[1] = 2;
			data[2] = (byte) 0xed;
			data[3] = (byte) 0xc6;			

			count++;
			if (count == 20)
				break;
			/*
			 * byte s1 =0; data[0]=0;data[1]=3;data[2]=0;data[3]=(byte)count;
			 * count++; if(count==8) count=0;
			 */

			try {
				packet = new DatagramPacket(data, data.length,
						InetAddress.getByName("127.0.0.1"), 21114);
				socket.send(packet);
				System.out.println("Sending @");
			} catch (Exception exe) {
				exe.printStackTrace();
			}
		}

	}
}
